package com.gouqi.mall;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@MapperScan("com.gouqi.mall")
@Api(basePath = "/api/v1", value = "测试项目接口",
        description = "测试一下项目是否启动",
        produces = "application/json")
@EnableAutoConfiguration
@RestController
@RequestMapping(value = "/project")
@SpringBootApplication
public class StartApplication {
    /**
     * 用户首页，用于登录之后给用户看一些信息
     * 信息可以从数据库中取，这边作为demo，暂时写死
     * @return
     */
    @RequestMapping(value = "/text",method = RequestMethod.GET,produces = MediaType.TEXT_PLAIN_VALUE)
    @ApiOperation(value="测试地址", notes="测试")
    String home(HttpServletRequest request) {
        String userName = "xiaofei";
        int count = 100;
        return "欢迎您" + userName + "，这是您的第 " + count + " 次登录";
    }

    public static void main(String[] args) {
        SpringApplication.run(StartApplication.class, args);
    }

}
